home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Using a Base constructor for a derived class
  5. Date: 16 Jan 1996 09:31:59 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4dfraf$8vr@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe9.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 15, 1996 11:15:05 in article <Using a Base constructor for a derived
  15. class>, 'culbreth@cc.gatech.edu (Matthew W. Culbreth)' wrote: 
  16.  
  17.  
  18. >Howdy, 
  19. >I have a base class with a constructor.  This class is never used 
  20. >in my application.  I have three classes derived from this class. 
  21. >When I create an instant of one of the derived class, I want to use the  
  22. >constructor from the base class.  The compiler is stating that it can't
  23. find  
  24. >the constructor for the arguments passed for any of the derived classes. 
  25. >Are constructors inherited the same as member functions? 
  26.  
  27. Base class constructors must be called explicitly: 
  28.  
  29. Deriv::Deriv(int a, float b, const char * c) 
  30.   : Base(a), Otherbase(c, a), localvar(b) 
  31.    ... Deriv-specific code. 
  32.  } 
  33. -- 
  34. Pete Grant 
  35. Kalevi, Inc. 
  36. Object Oriented Software Development
  37.